package demo1;

import java.util.Stack;

public class Test {
    public static void main(String[] args) {
        Stack<Integer> stack = new Stack<>();
        stack.push(1);
        stack.push(21);
        stack.push(13);
        //获取栈顶元素,但是不删除   13
        System.out.println(stack.peek());
        //弹出栈顶元素,并且删除   13
        System.out.println(stack.pop());
        System.out.println(stack.peek()); //21

        //判断是否为空
        System.out.println(stack.empty());
        //查询某个元素
        System.out.println(stack.search(21));
    }
}
